USE [PaltopDatabase]
GO

USE [PaltopDatabase]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK__StickyNot__Accou__173876EA]') AND parent_object_id = OBJECT_ID(N'[dbo].[StickyNotes]'))
ALTER TABLE [dbo].[StickyNotes] DROP CONSTRAINT [FK__StickyNot__Accou__173876EA]
GO

USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[StickyNotes]    Script Date: 10/24/2011 23:14:30 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[StickyNotes]') AND type in (N'U'))
DROP TABLE [dbo].[StickyNotes]
GO



/****** Object:  Table [dbo].[Account]    Script Date: 10/24/2011 23:12:54 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Account]') AND type in (N'U'))
DROP TABLE [dbo].[Account]
GO

USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[Account]    Script Date: 10/24/2011 23:12:54 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Account](
	[AccountID] [int] IDENTITY(1,1) NOT NULL,
	[Email] [nvarchar](50) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[RegisterDate] [datetime] NOT NULL,
	[Password] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_ACCOUNT] PRIMARY KEY CLUSTERED 
(
	[AccountID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


USE [PaltopDatabase]
GO

/****** Object:  Table [dbo].[StickyNotes]    Script Date: 10/24/2011 23:15:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[StickyNotes](
	[StickyNoteID] [int] IDENTITY(1,1) NOT NULL,
	[SavedDate] [datetime] NOT NULL,
	[Content] [nvarchar](max) NOT NULL,
	[AccountID] [int] NOT NULL,
	[XPosition] [int] NOT NULL,
	[YPosition] [int] NOT NULL,
 CONSTRAINT [PK_StickyNotes] PRIMARY KEY CLUSTERED 
(
	[StickyNoteID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[StickyNotes]  WITH CHECK ADD FOREIGN KEY([AccountID])
REFERENCES [dbo].[Account] ([AccountID])
GO

